import 'package:kkhousekeep/generated/json/base/json_field.dart';
import 'package:kkhousekeep/generated/json/order_list_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class OrderListEntity {
  late int code;
  late List<OrderListObj> obj;
  late String msg;

  OrderListEntity();

  factory OrderListEntity.fromJson(Map<String, dynamic> json) =>
      $OrderListEntityFromJson(json);

  Map<String, dynamic> toJson() => $OrderListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  OrderListEntity copyWith({int? code, List<OrderListObj>? obj, String? msg}) =>
      OrderListEntity()
        ..code = code ?? this.code
        ..obj = obj ?? this.obj
        ..msg = msg ?? this.msg;
}

@JsonSerializable()
class OrderListObj {
  late int id;
  late String woSn;
  late String cTime;
  late String address;
  late String fatalType;
  late int urgency;
  late int area;

  OrderListObj();

  factory OrderListObj.fromJson(Map<String, dynamic> json) =>
      $OrderListObjFromJson(json);

  Map<String, dynamic> toJson() => $OrderListObjToJson(this);

  OrderListObj copyWith(
          {int? id,
          String? woSn,
          String? cTime,
          String? address,
          String? fatalType,
          int? urgency,
          int? area}) =>
      OrderListObj()
        ..id = id ?? this.id
        ..woSn = woSn ?? this.woSn
        ..cTime = cTime ?? this.cTime
        ..address = address ?? this.address
        ..fatalType = fatalType ?? this.fatalType
        ..urgency = urgency ?? this.urgency
        ..area = area ?? this.area;

  @override
  String toString() {
    return jsonEncode(this);
  }
}
